home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / Common / include / dmutil.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-31  |  4.3 KB  |  127 lines

  1. //-----------------------------------------------------------------------------
  2. // File: DMUtil.h
  3. //
  4. // Desc: 
  5. //
  6. // Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #ifndef DMUTIL_H
  9. #define DMUTIL_H
  10.  
  11. #include <dmusicc.h>
  12. #include <dmusici.h>
  13. #include <dsound.h>
  14.  
  15.  
  16. //-----------------------------------------------------------------------------
  17. // Classes used by this header
  18. //-----------------------------------------------------------------------------
  19. class CMusicManager;
  20. class CMusicSegment;
  21. class CMusicScript;
  22.  
  23.  
  24.  
  25.  
  26. //-----------------------------------------------------------------------------
  27. // Name: class CMusicManager
  28. // Desc: 
  29. //-----------------------------------------------------------------------------
  30. class CMusicManager
  31. {
  32. protected:
  33.     BOOL                      m_bCleanupCOM;
  34.     IDirectMusicLoader8*      m_pLoader;
  35.     IDirectMusicPerformance8* m_pPerformance;
  36.  
  37. public:
  38.     CMusicManager();
  39.     ~CMusicManager();
  40.  
  41.     inline IDirectMusicLoader8*      GetLoader()      { return m_pLoader; }
  42.     inline IDirectMusicPerformance8* GetPerformance() { return m_pPerformance; }
  43.     IDirectMusicAudioPath8* GetDefaultAudioPath();
  44.  
  45.     HRESULT Initialize( HWND hWnd, DWORD dwPChannels = 128, DWORD dwDefaultPathType = DMUS_APATH_DYNAMIC_STEREO );
  46.  
  47.     HRESULT SetSearchDirectory( const TCHAR* strMediaPath );
  48.     VOID    CollectGarbage();
  49.  
  50.     HRESULT CreateSegmentFromFile( CMusicSegment** ppSegment, TCHAR* strFileName, 
  51.                                    BOOL bDownloadNow = TRUE, BOOL bIsMidiFile = FALSE );
  52.     HRESULT CreateScriptFromFile( CMusicScript** ppScript, TCHAR* strFileName );
  53.  
  54.     HRESULT CreateChordMapFromFile( IDirectMusicChordMap8** ppChordMap, TCHAR* strFileName );
  55.     HRESULT CreateStyleFromFile( IDirectMusicStyle8** ppStyle, TCHAR* strFileName );
  56.     HRESULT GetMotifFromStyle( IDirectMusicSegment8** ppMotif, TCHAR* strStyle, TCHAR* wstrMotif );
  57.  
  58.     HRESULT CreateSegmentFromResource( CMusicSegment** ppSegment, TCHAR* strResource, TCHAR* strResourceType, 
  59.                                    BOOL bDownloadNow = TRUE, BOOL bIsMidiFile = FALSE );
  60. };
  61.  
  62.  
  63.  
  64.  
  65. //-----------------------------------------------------------------------------
  66. // Name: class CMusicSegment
  67. // Desc: Encapsulates functionality of an IDirectMusicSegment
  68. //-----------------------------------------------------------------------------
  69. class CMusicSegment
  70. {
  71. protected:
  72.     IDirectMusicSegment8*     m_pSegment;
  73.     IDirectMusicLoader8*      m_pLoader;
  74.     IDirectMusicPerformance8* m_pPerformance;
  75.     IDirectMusicAudioPath8*   m_pEmbeddedAudioPath;
  76.     BOOL                      m_bDownloaded;
  77.  
  78. public:
  79.     CMusicSegment( IDirectMusicPerformance8* pPerformance, 
  80.                    IDirectMusicLoader8* pLoader,
  81.                    IDirectMusicSegment8* pSegment );
  82.     virtual ~CMusicSegment();
  83.  
  84.     inline  IDirectMusicSegment8* GetSegment() { return m_pSegment; }
  85.     HRESULT GetStyle( IDirectMusicStyle8** ppStyle, DWORD dwStyleIndex = 0 );
  86.  
  87.     HRESULT SetRepeats( DWORD dwRepeats );
  88.     HRESULT Play( DWORD dwFlags = DMUS_SEGF_SECONDARY, IDirectMusicAudioPath8* pAudioPath = NULL );
  89.     HRESULT Stop( DWORD dwFlags = 0 );
  90.     HRESULT Download( IDirectMusicAudioPath8* pAudioPath = NULL );
  91.     HRESULT Unload( IDirectMusicAudioPath8* pAudioPath = NULL );
  92.  
  93.     BOOL    IsPlaying();
  94. };
  95.  
  96.  
  97.  
  98.  
  99. //-----------------------------------------------------------------------------
  100. // Name: class CMusicScript
  101. // Desc: Encapsulates functionality of an IDirectMusicScript
  102. //-----------------------------------------------------------------------------
  103. class CMusicScript
  104. {
  105. protected:
  106.     IDirectMusicScript8*      m_pScript;
  107.     IDirectMusicLoader8*      m_pLoader;
  108.     IDirectMusicPerformance8* m_pPerformance;
  109.  
  110. public:
  111.     CMusicScript( IDirectMusicPerformance8* pPerformance, 
  112.                   IDirectMusicLoader8* pLoader,
  113.                   IDirectMusicScript8* pScript );
  114.     virtual ~CMusicScript();
  115.  
  116.     inline  IDirectMusicScript8* GetScript() { return m_pScript; }
  117.  
  118.     HRESULT CallRoutine( TCHAR* strRoutine );
  119.     HRESULT SetVariableNumber( TCHAR* strVariable, LONG lValue );
  120.     HRESULT GetVariableNumber( TCHAR* strVariable, LONG* plValue );
  121. };
  122.  
  123.  
  124.  
  125.  
  126. #endif // DMUTIL_H
  127.